<extend name="base" />

<block name="style">
<style type="text/css">
.table_addbug{width:700px;}
.table_addbug tr:first-child{background-color:rgb(245,246,250)}
.table_addbug tr td:first-child{border-right:#CCC 1px solid; width:80px; height:32px;}
label{color:#333}
.step2{display:none;}
</style>
</block>

<block name="md_title">
	<div class="title">Bug添加</div>
    <button class="buttonC" style="float:left">返回列表</button>
    <button class="buttonA step1">编辑</button>
    <button class="buttonC step2">还原</button>
    <button class="buttonA step2">提交</button>
</block>

<block name="main_cont">
	<div class="table_view_info step1">
	<table class="table_addbug">
    	<tr><td><label>简述</label></td>
        	<td>{$title}</td></tr>
        <tr><td><label>版本</label></td>
        	<td>{$version}</td></tr>
        <tr><td><label>负责人</label></td>
        	<td>{$ownerid}</td></tr>
        <tr><td><label>平台</label></td>
        	<td>{$Think.config.BUG_PLATFORM.$platform}</td></tr>
        <tr><td><label>模块</label></td>
        	<td>{$Think.config.BUG_MODULE.$module}</td></tr>
        <tr><td><label>级别</label></td>
        	<td>{$Think.config.BUG_LEVEL.$level|substr=###,0,6}</td></tr>
        <tr><td><label>状态</label></td>
            <td>{$Think.config.BUG_STATUS.$status}</td></tr>
        <tr><td valign="top"><label>详情</label></td>
        	<td>
            	{$content}
            </td></tr>
    </table>
    </div>
    
	<div class="table_edit_info step2">
	<table class="table_addbug">
    <form action="changeBug" method="post"><input type="hidden" name="bugid" value="{$bugid}">
    	<tr><td><label>简述</label></td>
        	<td><input type="text" name="title" value="{$title}" class="textA"></td></tr>
        <tr><td><label>版本</label></td>
        	<td><input type="text" name="version" value="{$version}" class="textB"></td></tr>
        <tr><td><label>负责人</label></td>
        	<td><select name="ownerid" class="textB">
            		<foreach name="Think.session.bw_AllUser" item="value">
                    	<if condition="$key eq $ownerid"><option value="{$key}" selected="selected">{$value}</option>
                    	<else /><option value="{$key}">{$value}</option></if>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>平台</label></td>
        	<td><select name="platform" class="textB">
            		<foreach name="Think.config.BUG_PLATFORM" item="value">
                    	<if condition="$key eq $platform"><option value="{$key}" selected="selected">{$value}</option>
                    	<else /><option value="{$key}">{$value}</option></if>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>模块</label></td>
        	<td><select name="module" class="textB">
            		<foreach name="Think.config.BUG_MODULE" item="value">
                    	<if condition="$key eq $module"><option value="{$key}" selected="selected">{$value}</option>
                    	<else /><option value="{$key}">{$value}</option></if>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>级别</label></td>
        	<td><select name="level" class="textB">
            		<foreach name="Think.config.BUG_LEVEL" item="value">
                    	<if condition="($key eq $level)"><option value="{$key}" selected="selected">{$value}</option>
                    	<else /><option value="{$key}">{$value}</option></if>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>状态</label></td>
            <td><select name="status" class="textB">
            		<foreach name="Think.config.BUG_STATUS" item="value">
                    	<if condition="$key eq $status"><option value="{$key}" selected="selected">{$value}</option>
                    	<else /><option value="{$key}">{$value}</option></if>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>详情</label></td>
        	<td>
            	<textarea id="textArea" name="content">{$content}</textarea>
            </td></tr>
    </form>
    </table>
    </div>
    <div id="uploadContainer" style="display:none;"><input id="file_upload" name="file_upload" type="file" multiple></div>
</block>

<block name="script">
<link href="__ROOT__/Public/WangEditor/css/wangEditor-1.3.12.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Uploadify/uploadify.css">
<script src="__ROOT__/Public/WangEditor/js/wangEditor-1.3.12.min.js"></script>
<script src="__ROOT__/Public/Uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script language="javascript">
var editor = $('#textArea').wangEditor({
    uploadImgComponent:$('#uploadContainer'),
	'menuConfig': [
    	['bold', 'underline', 'italic', 'foreColor', 'backgroundColor', 'strikethrough'],
    	['blockquote', 'fontFamily', 'fontSize', 'setHead', 'list', 'justify'],
    	['createLink', 'unLink', 'insertTable'],
    	['insertImage', 'insertVideo', 'insertLocation','insertCode'],
    	['undo', 'redo', 'fullScreen']
    ]
});

$('#file_upload').uploadify({
	'swf'      : '__PUBLIC__/Uploadify/uploadify.swf',
	'uploader' : '{:U("Index/upLoadFile")}',   //上传的方法
	'buttonText' : '浏览图片',
	'onUploadSuccess' : function(file, data, response) {
		var imgSrc	= '__PUBLIC__/Image/Bug/'+data;
		editor.html(editor.html()+"<br><img src="+imgSrc+"><br>");
	}
});

function checkInput(){
	$title	= $("[name='title']").val();
	$version	= $("[name = 'version']").val();
	if($title == ""){
		alert("简述不能为空!"); return false;
	}else{
		return true;
	}
}

</script>
</block>